<div class="pin">
	<div class="info">
		<h4 class="info-header">{lang album_comment}</h4>
		<div class="albumcomment">
			<textarea id="$album['album_id']_albumcommentbox" rows="2" class="borderclass" onkeyup="javascript:strLenCalc(this, '$album['album_id']checklen', 140);"></textarea>
			<div class="comactions">
				<span class="smalltxt">{lang can_input}<b id="$album['album_id']checklen">140</b>{lang character}</span><button data-action="addAlbumComment" data-params="$album['album_id'],albumcomment,true" class="btn btn-puzz pull-right">{lang comment}</button>
			</div>
		</div>
		<div id="$album['album_id']_albumcomments">
		
		</div>
		<div id="pager" class="pagination text_c mt10 mb10 hide"></div>
	</div>
</div>
<script type="text/javascript" language="javascript">
			        $(document).ready(function() {
		  				{if $total_comments>0}
			            var totalPages = Math.ceil(Number({$total_comments})/5);
			            var aid = {$album['album_id']};
			            $("#pager").pager({ pagenumber: 1, pagecount: totalPages, buttonClickCallback: PageClick });
						if(totalPages>1){
							$("#pager").removeClass('hide');
						}
			            function PageClick(pageclickednumber) {
			                $("#pager").pager({ pagenumber: pageclickednumber, pagecount: totalPages, buttonClickCallback: PageClick });
							var tpl_e = $('#albumcomment_tpl');
							var data = {'aid' : aid,'page' : pageclickednumber};
							ajaxpost('{url comment/getalbumcomments}', data, 
								function(result){
									var new_comment = $(Mustache.to_html(tpl_e.html(), result));
									$('#' + aid + '_albumcomments').html(new_comment);
									new_comment.fadeIn(1000);
									$('#' + aid + '_albumcommentbox').val('');

									$('#waterfall').masonry('reload');
								},
								function(result){
									show_message('error',tip_error+' : '+$.trim(result.message),false,0);
								});
			            }
			            PageClick(1);
						{/if}
			     });
</script>
<script type="text/template" id="albumcomment_tpl" reload="true">
{{#data}} 
<div class="albumcomment hide" id="albumcomment_{{comment_id}}">
	<div class="shareface"><a class="trans07" href="javascript: void(0);" data-user-id="{{user_id}}" data-user-profile="1"><img src="{{user_avatar}}" onerror="javascript:this.src = base_url + '/assets/img/avatar_small.jpg';" width="30" height="30"></a></div>
	<div class="shareinfo"><h3><a href="javascript: void(0);" data-user-id="{{user_id}}" data-user-profile="1">{{nickname}}</a> <i class="time">{{&post_time_friend}}</i>
	{{#delete}}<a href="javascript:void(0);" class="others pull-right" data-action="delalbumComment" data-params="{{album_id}},{{comment_id}}">{lang delete}</a>{{/delete}}</h3><p>{{&comment_txt}}</p></div>
</div>
 {{/data}} 
</script>